var express = require('express');
var expressWs = require('express-ws');

var router = express.Router();
expressWs(router);

router
  .ws('/test', function (ws, req){
      ws.on('message', function (msg) {
        console.log(`receive message ${msg}`) 
      })
      ws.send('Hello client!')
   })
  .get('/test', function(req, resp) {
    res.sendFile(__dirname + "/test.html");
  })
  

module.exports = router;